<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Interactive Features - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.pdf.interactive-features.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.pdf.interactive-features.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.pdf.drawing.html">Drawing</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.pdf.html">Zend_Pdf</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.pdf.info.html">Document Info and Metadata</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.pdf.interactive-features" class="section"><div class="info"><h1 class="title">Interactive Features</h1></div>
    

    <div class="section" id="zend.pdf.pages.interactive-features.destinations"><div class="info"><h1 class="title">Destinations</h1></div>
        

        <p class="para">
            A destination defines a particular view of a document, consisting of the following
            items:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">The page of the document to be displayed.</p>
            </li>

            <li class="listitem">
                <p class="para">The location of the document window on that page.</p>
            </li>

            <li class="listitem">
                <p class="para">The magnification (zoom) factor to use when displaying the page.</p>
            </li>
        </ul>

        <p class="para">
            Destinations may be associated with outline items (<a href="zend.pdf.interactive-features.html#zend.pdf.pages.interactive-features.outlines" class="link">Document
            Outline (bookmarks)</a>), annotations (<a href="zend.pdf.interactive-features.html#zend.pdf.pages.interactive-features.annotations" class="link">Annotations</a>), or
            actions (<a href="zend.pdf.interactive-features.html#zend.pdf.pages.interactive-features.actions" class="link">Actions</a>).
            In each case, the destination specifies the view of the document to be presented
            when the outline item or annotation is opened or the action is performed. In addition,
            the optional document open action can be specified.
        </p>

        <div class="section" id="zend.pdf.pages.interactive-features.destinations.types"><div class="info"><h1 class="title">Supported Destination Types</h1></div>
            

            <p class="para">
                The following types are supported by <span class="classname">Zend_Pdf</span> component.
            </p>

            <div class="section" id="zend.pdf.pages.interactive-features.destinations.types.zoom"><div class="info"><h1 class="title">Zend_Pdf_Destination_Zoom</h1></div>
                

                <p class="para">
                    Display the specified page, with the coordinates (left, top) positioned at
                    the upper-left corner of the window and the contents of the page magnified
                    by the factor zoom.
                </p>

                <p class="para">
                    Destination object may be created using
                     <span class="methodname">Zend_Pdf_Destination_Zoom::create($page, $left = null, $top = null,
                        $zoom = null)</span>
                    method.
                </p>

                <p class="para">
                    Where:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$page</var> is a destination page
                            (a <span class="classname">Zend_Pdf_Page</span> object or a page number).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$left</var> is a left edge of the displayed page (float).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$top</var> is a top edge of the displayed page (float).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$zoom</var> is a zoom factor (float).
                        </p>
                    </li>
                </ul>

                <p class="para">
                   <b><tt>NULL</tt></b>, specified for <var class="varname">$left</var>,
                   <var class="varname">$top</var> or <var class="varname">$zoom</var> parameter means
                   &quot;current viewer application value&quot;.
                </p>

                <p class="para">
                    <span class="classname">Zend_Pdf_Destination_Zoom</span> class also provides
                    the following methods:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getLeftEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setLeftEdge(float $left)</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getTopEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setTopEdge(float $top)</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getZoomFactor()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setZoomFactor(float $zoom)</span>;</p>
                    </li>
                </ul>
            </div>

            <div class="section" id="zend.pdf.pages.interactive-features.destinations.types.fit"><div class="info"><h1 class="title">Zend_Pdf_Destination_Fit</h1></div>
                

                <p class="para">
                    Display the specified page, with the coordinates (left, top) positioned at
                    the upper-left corner of the window and the contents of the page magnified
                    by the factor zoom.
                    Display the specified page, with its contents magnified just enough to fit
                    the entire page within the window both horizontally and vertically. If
                    the required horizontal and vertical magnification factors are different, use
                    the smaller of the two, centering the page within the window in the other
                    dimension.
                </p>

                <p class="para">
                    Destination object may be created using
                     <span class="methodname">Zend_Pdf_Destination_Fit::create($page)</span>
                    method.
                </p>

                <p class="para">
                    Where <var class="varname">$page</var> is a destination page
                    (a <span class="classname">Zend_Pdf_Page</span> object or a page number).
                </p>
            </div>

            <div class="section" id="zend.pdf.pages.interactive-features.destinations.types.fit-horizontally"><div class="info"><h1 class="title">Zend_Pdf_Destination_FitHorizontally</h1></div>
                

                <p class="para">
                    Display the specified page, with the vertical coordinate top positioned at
                    the top edge of the window and the contents of the page magnified just enough
                    to fit the entire width of the page within the window.
                </p>

                <p class="para">
                    Destination object may be created using
                     <span class="methodname">Zend_Pdf_Destination_FitHorizontally::create($page,
                        $top)</span> method.
                </p>

                <p class="para">
                    Where:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$page</var> is a destination page
                            (a <span class="classname">Zend_Pdf_Page</span> object or a page number).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$top</var> is a top edge of the displayed page
                            (float).
                        </p>
                    </li>
                </ul>

                <p class="para">
                    <span class="classname">Zend_Pdf_Destination_FitHorizontally</span> class also
                    provides the following methods:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getTopEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setTopEdge(float $top)</span>;</p>
                    </li>
                </ul>
            </div>

            <div class="section" id="zend.pdf.pages.interactive-features.destinations.types.fit-vertically"><div class="info"><h1 class="title">Zend_Pdf_Destination_FitVertically</h1></div>
                

                <p class="para">
                    Display the specified page, with the horizontal coordinate left positioned
                    at the left edge of the window and the contents of the page magnified just
                    enough to fit the entire height of the page within the window.
                </p>

                <p class="para">
                    Destination object may be created using
                     <span class="methodname">Zend_Pdf_Destination_FitVertically::create($page,
                        $left)</span> method.
                </p>

                <p class="para">
                    Where:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$page</var> is a destination page
                            (a <span class="classname">Zend_Pdf_Page</span> object or a page number).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$left</var> is a left edge of the displayed page
                            (float).
                        </p>
                    </li>
                </ul>

                <p class="para">
                    <span class="classname">Zend_Pdf_Destination_FitVertically</span> class also
                    provides the following methods:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getLeftEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setLeftEdge(float $left)</span>;</p>
                    </li>
                </ul>
            </div>

            <div class="section" id="zend.pdf.pages.interactive-features.destinations.types.fit-rectangle"><div class="info"><h1 class="title">Zend_Pdf_Destination_FitRectangle</h1></div>
                

                <p class="para">
                    Display the specified page, with its contents magnified just enough to fit
                    the rectangle specified by the coordinates left, bottom, right, and top
                    entirely within the window both horizontally and vertically. If the required
                    horizontal and vertical magnification factors are different, use the smaller
                    of the two, centering the rectangle within the window in the other dimension.
                </p>

                <p class="para">
                    Destination object may be created using
                     <span class="methodname">Zend_Pdf_Destination_FitRectangle::create($page, $left, $bottom,
                        $right, $top)</span> method.
                </p>

                <p class="para">
                    Where:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$page</var> is a destination page
                            (a <span class="classname">Zend_Pdf_Page</span> object or a page number).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$left</var> is a left edge of the displayed page
                            (float).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$bottom</var> is a bottom edge of the displayed page
                            (float).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$right</var> is a right edge of the displayed page (float).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$top</var> is a top edge of the displayed page (float).
                        </p>
                    </li>
                </ul>

                <p class="para">
                    <span class="classname">Zend_Pdf_Destination_FitRectangle</span> class also
                    provides the following methods:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getLeftEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setLeftEdge(float $left)</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getBottomEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setBottomEdge(float $bottom)</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getRightEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setRightEdge(float $right)</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getTopEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setTopEdge(float $top)</span>;</p>
                    </li>
                </ul>
            </div>

            <div class="section" id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box"><div class="info"><h1 class="title">Zend_Pdf_Destination_FitBoundingBox</h1></div>
                

                <p class="para">
                    Display the specified page, with its contents magnified just enough to fit
                    its bounding box entirely within the window both horizontally and vertically.
                    If the required horizontal and vertical magnification factors are different,
                    use the smaller of the two, centering the bounding box within the window in
                    the other dimension.
                </p>

                <p class="para">
                    Destination object may be created using
                     <span class="methodname">Zend_Pdf_Destination_FitBoundingBox::create($page, $left, $bottom,
                        $right, $top)</span> method.
                </p>

                <p class="para">
                    Where <var class="varname">$page</var> is a destination page
                    (a <span class="classname">Zend_Pdf_Page</span> object or a page number).
                </p>
            </div>

            <div class="section" id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-horizontally"><div class="info"><h1 class="title">Zend_Pdf_Destination_FitBoundingBoxHorizontally</h1></div>
                

                <p class="para">
                    Display the specified page, with the vertical coordinate top positioned at
                    the top edge of the window and the contents of the page magnified just enough
                    to fit the entire width of its bounding box within the window.
                </p>

                <p class="para">
                    Destination object may be created using
                     <span class="methodname">Zend_Pdf_Destination_FitBoundingBoxHorizontally::create($page,
                        $top)</span> method.
                </p>

                <p class="para">
                    Where
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$page</var> is a destination page
                            (a <span class="classname">Zend_Pdf_Page</span> object or a page number).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$top</var> is a top edge of the displayed page
                            (float).
                        </p>
                    </li>
                </ul>

                <p class="para">
                    <span class="classname">Zend_Pdf_Destination_FitBoundingBoxHorizontally</span> class
                    also provides the following methods:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getTopEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setTopEdge(float $top)</span>;</p>
                    </li>
                </ul>
            </div>

            <div class="section" id="zend.pdf.pages.interactive-features.destinations.types.fit-bounding-box-vertically"><div class="info"><h1 class="title">Zend_Pdf_Destination_FitBoundingBoxVertically</h1></div>
                

                <p class="para">
                    Display the specified page, with the horizontal coordinate left positioned at
                    the left edge of the window and the contents of the page magnified just
                    enough to fit the entire height of its bounding box within the window.
                </p>

                <p class="para">
                    Destination object may be created using
                     <span class="methodname">Zend_Pdf_Destination_FitBoundingBoxVertically::create($page,
                        $left)</span> method.
                </p>

                <p class="para">
                    Where
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$page</var> is a destination page
                            (a <span class="classname">Zend_Pdf_Page</span> object or a page number).
                        </p>
                    </li>

                    <li class="listitem">
                        <p class="para">
                            <var class="varname">$left</var> is a left edge of the displayed page
                            (float).
                        </p>
                    </li>
                </ul>

                <p class="para">
                    <span class="classname">Zend_Pdf_Destination_FitBoundingBoxVertically</span> class
                    also provides the following methods:
                </p>

                <ul class="itemizedlist">
                    <li class="listitem">
                        <p class="para"><span class="type">Float</span> <span class="methodname">getLeftEdge()</span>;</p>
                    </li>

                    <li class="listitem">
                        <p class="para"> <span class="methodname">setLeftEdge(float $left)</span>;</p>
                    </li>
                </ul>
            </div>

            <div class="section" id="zend.pdf.pages.interactive-features.destinations.types.named"><div class="info"><h1 class="title">Zend_Pdf_Destination_Named</h1></div>
                

                <p class="para">
                    All destinations listed above are &quot;Explicit Destinations&quot;.
                </p>

                <p class="para">
                    In addition to this, <acronym class="acronym">PDF</acronym> document may contain a dictionary
                    of such destinations which may be used to reference from outside the
                    <acronym class="acronym">PDF</acronym> (e.g.
                    &#039;<var class="filename">http://www.mycompany.com/document.pdf#chapter3</var>&#039;).
                </p>

                <p class="para">
                    <span class="classname">Zend_Pdf_Destination_Named</span> objects allow to refer
                    destinations from the document named destinations dictionary.
                </p>

                <p class="para">
                    Named destination object may be created using
                     <span class="methodname">Zend_Pdf_Destination_Named::create(string $name)</span>
                    method.
                </p>

                <p class="para">
                    <span class="classname">Zend_Pdf_Destination_Named</span> class provides the only one
                    additional method:
                </p>

                <p class="para">
                    <span class="type">String</span> <span class="methodname">getName()</span>;
                </p>
            </div>
        </div>

        <div class="section" id="zend.pdf.pages.interactive-features.destinations.processing"><div class="info"><h1 class="title">Document level destination processing</h1></div>
            

            <p class="para">
                <span class="classname">Zend_Pdf</span> class provides a set of destinations processing
                methods.
            </p>

            <p class="para">
                Each destination object (including named destinations) can be resolved using the
                 <span class="methodname">resolveDestination($destination)</span> method. It returns
                corresponding <span class="classname">Zend_Pdf_Page</span> object, if destination target
                is found, or <b><tt>NULL</tt></b> otherwise.
            </p>

            <p class="para">
                 <span class="methodname">Zend_Pdf::resolveDestination()</span> method also takes
                an optional boolean parameter <var class="varname">$refreshPageCollectionHashes</var>,
                which is <b><tt>TRUE</tt></b> by default. It forces
                <span class="classname">Zend_Pdf</span> object to refresh internal page collection hashes
                since document pages list may be updated by user using
                <var class="varname">Zend_Pdf::$pages</var> property
                (<a href="zend.pdf.pages.html" class="link">Working with Pages</a>).
                It may be turned off for performance reasons,
                if it&#039;s known that document pages list wasn&#039;t changed since last method
                request.
            </p>

            <p class="para">
                Complete list of named destinations can be retrieved using
                 <span class="methodname">Zend_Pdf::getNamedDestinations()</span> method. It returns
                an array of <span class="classname">Zend_Pdf_Target</span> objects, which are actually
                either an explicit destination or a GoTo action
                (<a href="zend.pdf.interactive-features.html#zend.pdf.pages.interactive-features.actions" class="link">Actions</a>).
            </p>

            <p class="para">
                 <span class="methodname">Zend_Pdf::getNamedDestination(string $name)</span> method returns
                specified named destination (an explicit destination or a GoTo action).
            </p>

            <p class="para">
                <acronym class="acronym">PDF</acronym> document named destinations dictionary may be updated with
                 <span class="methodname">Zend_Pdf::setNamedDestination(string $name, $destination)</span>
                method, where <var class="varname">$destination</var> is either an explicit destination
                (any destination except <span class="classname">Zend_Pdf_Destination_Named</span>) or
                a GoTo action.
            </p>

            <p class="para">
                If <b><tt>NULL</tt></b> is specified in place of
                <var class="varname">$destination</var>, then specified named destination is removed.
            </p>

            <blockquote class="note"><p><b class="note">Note</b>: 
                <p class="para">
                    Unresolvable named destinations are automatically removed from a document
                    while document saving.
                </p>
            </p></blockquote>

            <div class="example" id="zend.pdf.interactive-features.destinations.example-1"><div class="info"><p><b>Example #1 Destinations usage example</b></p></div>
                

                <pre class="programlisting brush: php">
$pdf = new Zend_Pdf();
$page1 = $pdf-&gt;newPage(Zend_Pdf_Page::SIZE_A4);
$page2 = $pdf-&gt;newPage(Zend_Pdf_Page::SIZE_A4);
$page3 = $pdf-&gt;newPage(Zend_Pdf_Page::SIZE_A4);
// Page created, but not included into pages list

$pdf-&gt;pages[] = $page1;
$pdf-&gt;pages[] = $page2;

$destination1 = Zend_Pdf_Destination_Fit::create($page2);
$destination2 = Zend_Pdf_Destination_Fit::create($page3);

// Returns $page2 object
$page = $pdf-&gt;resolveDestination($destination1);

// Returns null, page 3 is not included into document yet
$page = $pdf-&gt;resolveDestination($destination2);

$pdf-&gt;setNamedDestination(&#039;Page2&#039;, $destination1);
$pdf-&gt;setNamedDestination(&#039;Page3&#039;, $destination2);

// Returns $destination2
$destination = $pdf-&gt;getNamedDestination(&#039;Page3&#039;);

// Returns $destination1
$pdf-&gt;resolveDestination(Zend_Pdf_Destination_Named::create(&#039;Page2&#039;));

// Returns null, page 3 is not included into document yet
$pdf-&gt;resolveDestination(Zend_Pdf_Destination_Named::create(&#039;Page3&#039;));
</pre>

            </div>
        </div>
    </div>

    <div class="section" id="zend.pdf.pages.interactive-features.actions"><div class="info"><h1 class="title">Actions</h1></div>
        

        <p class="para">
            Instead of simply jumping to a destination in the document, an annotation or
            outline item can specify an action for the viewer application to perform,
            such as launching an application, playing a sound, or changing an annotation&#039;s
            appearance state.
        </p>

        <div class="section" id="zend.pdf.pages.interactive-features.actions.types"><div class="info"><h1 class="title">Supported action types</h1></div>
            

            <p class="para">
                The following action types are recognized while loading <acronym class="acronym">PDF</acronym>
                document:
            </p>

            <ul class="itemizedlist">
                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_GoTo</span> - go to
                        a destination in the current document.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_GoToR</span> - go to
                        a destination in another document.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_GoToE</span> - go to
                        a destination in an embedded file.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_Launch</span> - launch
                        an application or open or print a document.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_Thread</span> - begin reading
                        an article thread.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_URI</span> - resolve a
                        <acronym class="acronym">URI</acronym>.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_Sound</span> - play a sound.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_Movie</span> - play a movie.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_Hide</span> - hides or shows
                        one or more annotations on the screen.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_Named</span> - execute an action
                        predefined by the viewer application:
                    </p>

                    <ul class="itemizedlist">
                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">NextPage</em> - Go to the next page
                                of the document.
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">PrevPage</em> - Go to the previous
                                page of the document.
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">FirstPage</em> - Go to the first page
                                of the document.
                            </p>
                        </li>

                        <li class="listitem">
                            <p class="para">
                                <em class="emphasis">LastPage</em> - Go to the last page
                                of the document.
                            </p>
                        </li>
                    </ul>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_SubmitForm</span> - send data to
                        a uniform resource locator.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_ResetForm</span> - set fields
                        to their default values.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_ImportData</span> - import field
                        values from a file.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_JavaScript</span> - execute
                        a JavaScript script.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_SetOCGState</span> - set the state of
                        one or more optional content groups.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_Rendition</span> - control the
                        playing of multimedia content (begin, stop, pause, or resume
                        a playing rendition).
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_Trans</span> - update the display
                        of a document, using a transition dictionary.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <span class="classname">Zend_Pdf_Action_GoTo3DView</span> - set
                        the current view of a 3D annotation.
                    </p>
                </li>
            </ul>

            <p class="para">
                Only <span class="classname">Zend_Pdf_Action_GoTo</span> and
                <span class="classname">Zend_Pdf_Action_URI</span> actions can be created by
                user now.
            </p>

            <p class="para">
                GoTo action object can be created using
                 <span class="methodname">Zend_Pdf_Action_GoTo::create($destination)</span> method,
                where <var class="varname">$destination</var> is a
                <span class="classname">Zend_Pdf_Destination</span> object or a string which can be used
                to identify named destination.
            </p>

            <p class="para">
                 <span class="methodname">Zend_Pdf_Action_URI::create($uri[, $isMap])</span> method has
                to be used to create a URI action (see <acronym class="acronym">API</acronym> documentation for the
                details). Optional <var class="varname">$isMap</var> parameter is set to
                <b><tt>FALSE</tt></b> by default.
            </p>

            <p class="para">
                It also supports the following methods:
            </p>
        </div>

        <div class="section" id="zend.pdf.pages.interactive-features.actions.chaining"><div class="info"><h1 class="title">Actions chaining</h1></div>
            

            <p class="para">
                Actions objects can be chained using <var class="varname">Zend_Pdf_Action::$next</var>
                public property.
            </p>

            <p class="para">
                It&#039;s an array of <span class="classname">Zend_Pdf_Action</span> objects, which also
                may have their sub-actions.
            </p>

            <p class="para">
                <span class="classname">Zend_Pdf_Action</span> class supports RecursiveIterator interface,
                so child actions may be iterated recursively:
            </p>

            <pre class="programlisting brush: php">
$pdf = new Zend_Pdf();
$page1 = $pdf-&gt;newPage(Zend_Pdf_Page::SIZE_A4);
$page2 = $pdf-&gt;newPage(Zend_Pdf_Page::SIZE_A4);
// Page created, but not included into pages list
$page3 = $pdf-&gt;newPage(Zend_Pdf_Page::SIZE_A4);

$pdf-&gt;pages[] = $page1;
$pdf-&gt;pages[] = $page2;

$action1 = Zend_Pdf_Action_GoTo::create(
                            Zend_Pdf_Destination_Fit::create($page2));
$action2 = Zend_Pdf_Action_GoTo::create(
                            Zend_Pdf_Destination_Fit::create($page3));
$action3 = Zend_Pdf_Action_GoTo::create(
                            Zend_Pdf_Destination_Named::create(&#039;Chapter1&#039;));
$action4 = Zend_Pdf_Action_GoTo::create(
                            Zend_Pdf_Destination_Named::create(&#039;Chapter5&#039;));

$action2-&gt;next[] = $action3;
$action2-&gt;next[] = $action4;

$action1-&gt;next[] = $action2;

$actionsCount = 1; // Note! Iteration doesn&#039;t include top level action and
                   // walks through children only
$iterator = new RecursiveIteratorIterator(
                                        $action1,
                                        RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $chainedAction) {
    $actionsCount++;
}

// Prints &#039;Actions in a tree: 4&#039;
printf(&quot;Actions in a tree: %d\n&quot;, $actionsCount++);
</pre>

        </div>

        <div class="section" id="zend.pdf.pages.interactive-features.actions.open-action"><div class="info"><h1 class="title">Document Open Action</h1></div>
            

            <p class="para">
                Special open action may be specify a destination to be displayed or an action
                to be performed when the document is opened.
            </p>

            <p class="para">
                 <span class="methodname">Zend_Pdf_Target Zend_Pdf::getOpenAction()</span> method
                returns current document open action (or <b><tt>NULL</tt></b> if open action
                is not set).
            </p>

            <p class="para">
                 <span class="methodname">setOpenAction(Zend_Pdf_Target $openAction = null)</span>
                method sets document open action or clean it if <var class="varname">$openAction</var>
                is <b><tt>NULL</tt></b>.
            </p>
        </div>
    </div>

    <div class="section" id="zend.pdf.pages.interactive-features.outlines"><div class="info"><h1 class="title">Document Outline (bookmarks)</h1></div>
        

        <p class="para">
            A PDF document may optionally display a document outline on the screen, allowing
            the user to navigate interactively from one part of the document to another.
            The outline consists of a tree-structured hierarchy of outline items (sometimes
            called bookmarks), which serve as a visual table of contents to display the document&#039;s
            structure to the user. The user can interactively open and close individual
            items by clicking them with the mouse. When an item is open, its immediate children
            in the hierarchy become visible on the screen; each child may in turn be
            open or closed, selectively revealing or hiding further parts of the hierarchy.
            When an item is closed, all of its descendants in the hierarchy are hidden. Clicking
            the text of any visible item activates the item, causing the viewer application to
            jump to a destination or trigger an action associated with the item.
        </p>

        <p class="para">
            <span class="classname">Zend_Pdf</span> class provides public property
            <var class="varname">$outlines</var> which is an array of
            <span class="classname">Zend_Pdf_Outline</span> objects.

            <pre class="programlisting brush: php">
$pdf = Zend_Pdf::load($path);

// Remove outline item
unset($pdf-&gt;outlines[0]-&gt;childOutlines[1]);

// Set Outline to be displayed in bold
$pdf-&gt;outlines[0]-&gt;childOutlines[3]-&gt;setIsBold(true);

// Add outline entry
$pdf-&gt;outlines[0]-&gt;childOutlines[5]-&gt;childOutlines[] =
    Zend_Pdf_Outline::create(&#039;Chapter 2&#039;, &#039;chapter_2&#039;);

$pdf-&gt;save($path, true);
</pre>

        </p>

        <p class="para">
            Outline attributes may be retrieved or set using the following methods:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                     <span class="methodname">string getTitle()</span> - get outline item title.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">setTitle(string $title)</span> - set outline item title.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">boolean isOpen()</span> - <b><tt>TRUE</tt></b> if outline
                    is open by default.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">setIsOpen(boolean $isOpen)</span> - set isOpen state.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">boolean isItalic()</span> - <b><tt>TRUE</tt></b> if
                    outline item is displayed in italic.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">setIsItalic(boolean $isItalic)</span> - set
                    isItalic state.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">boolean isBold()</span> - <b><tt>TRUE</tt></b> if outline
                    item is displayed in bold.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">setIsBold(boolean $isBold)</span> - set
                    isBold state.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">Zend_Pdf_Color_Rgb getColor()</span> - get outline
                    text color (<b><tt>NULL</tt></b> means black).
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">setColor(Zend_Pdf_Color_Rgb $color)</span> - set
                    outline text color (<b><tt>NULL</tt></b> means black).
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">Zend_Pdf_Target getTarget()</span> - get outline
                    target (action or explicit or named destination object).
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">setTarget(Zend_Pdf_Target|string $target)</span> - set
                    outline target (action or destination). String may be used to identify
                    named destination. <b><tt>NULL</tt></b> means &#039;no target&#039;.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">array getOptions()</span> - get outline attributes
                    as an array.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">setOptions(array $options)</span> - set outline options.
                    The following options are recognized: &#039;title&#039;, &#039;open&#039;, &#039;color&#039;, &#039;italic&#039;,
                    &#039;bold&#039;, and &#039;target&#039;.
                </p>
            </li>
        </ul>

        <p class="para">
            New outline may be created in two ways:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                     <span class="methodname">Zend_Pdf_Outline::create(string $title[, Zend_Pdf_Target|string
                        $target])</span>
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">Zend_Pdf_Outline::create(array $options)</span>
                </p>
            </li>
        </ul>

        <p class="para">
            Each outline object may have child outline items listed in
            <var class="varname">Zend_Pdf_Outline::$childOutlines</var> public property.
            It&#039;s an array of <span class="classname">Zend_Pdf_Outline</span> objects,
            so outlines are organized in a tree.
        </p>

        <p class="para">
            <span class="classname">Zend_Pdf_Outline</span> class implements RecursiveArray interface,
            so child outlines may be recursively iterated using RecursiveIteratorIterator:
        </p>

        <pre class="programlisting brush: php">
$pdf = Zend_Pdf::load($path);

foreach ($pdf-&gt;outlines as $documentRootOutlineEntry) {
    $iterator = new RecursiveIteratorIterator(
                    $documentRootOutlineEntry,
                    RecursiveIteratorIterator::SELF_FIRST
                );
    foreach ($iterator as $childOutlineItem) {
        $OutlineItemTarget = $childOutlineItem-&gt;getTarget();
        if ($OutlineItemTarget instanceof Zend_Pdf_Destination) {
            if ($pdf-&gt;resolveDestination($OutlineItemTarget) === null) {
                // Mark Outline item with unresolvable destination
                // using RED color
                $childOutlineItem-&gt;setColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
            }
        } else if ($OutlineItemTarget instanceof Zend_Pdf_Action_GoTo) {
            $OutlineItemTarget-&gt;setDestination();
            if ($pdf-&gt;resolveDestination($OutlineItemTarget) === null) {
                // Mark Outline item with unresolvable destination
                // using RED color
                $childOutlineItem-&gt;setColor(new Zend_Pdf_Color_Rgb(1, 0, 0));
            }
        }
    }
}

$pdf-&gt;save($path, true);
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                All outline items with unresolved destinations (or destinations of GoTo
                actions) are updated while document saving by setting their targets to
                <b><tt>NULL</tt></b>. So document will not be corrupted by removing pages
                referenced by outlines.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.pdf.pages.interactive-features.annotations"><div class="info"><h1 class="title">Annotations</h1></div>
        

        <p class="para">
            An annotation associates an object such as a note, sound, or movie with a location
            on a page of a PDF document, or provides a way to interact with the user by means
            of the mouse and keyboard.
        </p>

        <p class="para">
            All annotations are represented by <span class="classname">Zend_Pdf_Annotation</span>
            abstract class.
        </p>

        <p class="para">
            Annotation may be attached to a page using
             <span class="methodname">Zend_Pdf_Page::attachAnnotation(Zend_Pdf_Annotation
                $annotation)</span> method.
        </p>

        <p class="para">
            Three types of annotations may be created by user now:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                     <span class="methodname">Zend_Pdf_Annotation_Link::create($x1, $y1, $x2, $y2,
                        $target)</span> where <var class="varname">$target</var> is an action object
                    or a destination or string (which may be used in place of named destination
                    object).
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">Zend_Pdf_Annotation_Text::create($x1, $y1, $x2, $y2,
                        $text)</span>
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">Zend_Pdf_Annotation_FileAttachment::create($x1, $y1, $x2, $y2,
                        $fileSpecification)</span>
                </p>
            </li>
        </ul>

        <p class="para">
            A link annotation represents either a hypertext link to a destination elsewhere in
            the document or an action to be performed.
        </p>

        <p class="para">
            A text annotation represents a &quot;sticky note&quot; attached to a point in the PDF document.
        </p>

        <p class="para">
            A file attachment annotation contains a reference to a file.
        </p>

        <p class="para">
            The following methods are shared between all annotation types:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para"> <span class="methodname">setLeft(float $left)</span></p>
            </li>

            <li class="listitem">
                <p class="para"> <span class="methodname">float getLeft()</span></p>
            </li>

            <li class="listitem">
                <p class="para"> <span class="methodname">setRight(float $right)</span></p>
            </li>

            <li class="listitem">
                <p class="para"> <span class="methodname">float getRight()</span></p>
            </li>

            <li class="listitem">
                <p class="para"> <span class="methodname">setTop(float $top)</span></p>
            </li>

            <li class="listitem">
                <p class="para"> <span class="methodname">float getTop()</span></p>
            </li>

            <li class="listitem">
                <p class="para"> <span class="methodname">setBottom(float $bottom)</span></p>
            </li>

            <li class="listitem">
                <p class="para"> <span class="methodname">float getBottom()</span></p>
            </li>

            <li class="listitem">
                <p class="para"> <span class="methodname">setText(string $text)</span></p>
            </li>

            <li class="listitem">
                <p class="para"> <span class="methodname">string getText()</span></p>
            </li>
        </ul>

        <p class="para">
            Text annotation property is a text to be displayed for the annotation or, if this
            type of annotation does not display text, an alternate description of the annotation&#039;s
            contents in human-readable form.
        </p>

        <p class="para">
            Link annotation objects also provide two additional methods:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                     <span class="methodname">setDestination(Zend_Pdf_Target|string $target)</span>
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                     <span class="methodname">Zend_Pdf_Target getDestination()</span>
                </p>
            </li>
        </ul>
    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.pdf.drawing.html">Drawing</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.pdf.html">Zend_Pdf</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.pdf.info.html">Document Info and Metadata</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.pdf.html">Zend_Pdf</a></li>
  <li><a href="zend.pdf.introduction.html">Introduction</a></li>
  <li><a href="zend.pdf.create.html">Creating and Loading PDF Documents</a></li>
  <li><a href="zend.pdf.save.html">Save Changes to PDF Documents</a></li>
  <li><a href="zend.pdf.pages.html">Working with Pages</a></li>
  <li><a href="zend.pdf.drawing.html">Drawing</a></li>
  <li class="active"><a href="zend.pdf.interactive-features.html">Interactive Features</a></li>
  <li><a href="zend.pdf.info.html">Document Info and Metadata</a></li>
  <li><a href="zend.pdf.usage.html">Zend_Pdf module usage example</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>